package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 斤斤计较的小Z {
    final static int N = (int) 1e7 + 10;
    static int ne[] = new int[N];
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] ss) throws IOException {
        char[] p = (" " + br.readLine()).toCharArray(), s = (" " + br.readLine()).toCharArray();

        //求next数组
        for (int i = 2, j = 0; i <= p.length - 1; i++) {
            while (j != 0 && p[i] != p[j + 1]) j = ne[j];
            if (p[i] == p[j + 1]) j++;
            ne[i] = j;
        }
        //匹配
        int res = 0;
        for (int i = 1, j = 0; i <= s.length - 1; i++) {
            if (j != 0 && s[i] != p[j + 1]) j = ne[j];
            if (s[i] == p[j + 1]) j++;
            if (j == p.length - 1) {
                res++;
                j = ne[j];
            }
        }
        System.out.println(res);
    }
}
